package Game1;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.Socket;

public class TankClient {
    private int udpPort;
    private static int UDP_PORT_START=2223;
    public TankClient() {
        udpPort=UDP_PORT_START++;
    }
    public void connected(String IP,int port) {
        Socket s=null;
        try {
            s=new Socket(IP,port);
            DataOutputStream dos=new DataOutputStream(s.getOutputStream());
            dos.writeInt(udpPort);
            DataInputStream dis=new DataInputStream(s.getInputStream());
            System.out.println("Connected to server! and server give me a ID:");
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                if(s!=null) {
                    s.close();
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}
